#ifdef OSGI_USE_15S_HEADER
#include "../interface/InterfaceDef.h"
#include "osgi-core/osgi-predefined.h"
#else // OSGI_USE_15S_HEADER
#ifndef IBUNDLECONTEXT_H__
#define IBUNDLECONTEXT_H__

#include "osgi-predefined.h"
#include "ISystemEvent.h"

OSGI_NAMESPACE_BEGIN

OSGI_INTERFACE IBundleEnumer
{
	virtual int OSGI_API Count() = 0;
	virtual IBundle* OSGI_API GetBundle(int index) = 0;
	virtual void OSGI_API Destroy() = 0;
};

struct IApplication;

OSGI_INTERFACE IBundleContext
{
	virtual ~IBundleContext() {}

	//获取本插件bundle对象
	virtual int OSGI_API GetBundle(
		IBundle** ppBundle) = 0;

	//获取其他插件bundle对象
	virtual int OSGI_API GetBundle(
		const char* bundleName,
		IBundle** ppBundle) = 0;

	//获取所有插件bundle对象
	virtual int OSGI_API GetBundles(
		IBundleEnumer** ppBundleEnumer) = 0;

	//bundle事件监听器注册
	virtual int OSGI_API RegisterBundleListener(
		IBundleEventListener* pBundleEventListener) = 0;

	//bundle事件监听器注销
	virtual int OSGI_API UnRegisterBundleListener(
		IBundleEventListener* pBundleEventListener) = 0;

	//bundle事件发布
	virtual int OSGI_API PublishBundleEvent(
		IBundleEvent* event) = 0;

	//获取服务管理器
	virtual int OSGI_API GetServiceManager(
		IServiceManager** ppServiceManager) = 0;

	//system事件监听器注册
	virtual int OSGI_API RegisterSystemListener(
		ISystemEventListener* pSystemEventListener) = 0;

	//system事件监听器注销
	virtual int OSGI_API UnRegisterSystemListener(
		ISystemEventListener* pSystemEventListener) = 0;

	//system事件发布
	virtual int OSGI_API PublishSystemEvent(
		ISystemEvent* event) = 0;

	//获取内存分配器
	virtual int OSGI_API GetAllocator(
		IAllocator** ppAllocator) = 0;

	//全局信息设置
	virtual int OSGI_API SetProperty(
		const char* key,
		const char* pVal) = 0;

	//全局信息获取
	virtual int OSGI_API GetProperty(
		const char* key, 
		char** ppVal) = 0;
	
	//获取应用管理器
	virtual int OSGI_API GetApplication(
		IApplication** ppApplication) = 0; 
};

OSGI_NAMESPACE_END

#endif // IBUNDLECONTEXT_H__
#endif // OSGI_USE_15S_HEADER
